package com.jy.modules.cims.report.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.Mapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.jy.modules.cims.common.controller.CimsBaseController;
import com.jy.modules.cims.data.common.dto.TCMmCooperorgDealDTO;
import com.jy.modules.cims.data.dto.CreditRightTotalDto;
import com.jy.modules.cims.deal.service.DealService;
import com.jy.platform.core.message.DataMsg;
import com.jy.platform.core.message.PageParameter;
import com.jy.platform.core.message.PageUtil;
import com.jy.platform.core.message.QueryReqBean;

/**
 * 统计报表
 * <b>类名称：</b>ReportController <br/>
 * <b>类描述：</b><br/>
 * <b>创建人：</b>lizhiqiang<br/>
 * <b>修改人：</b><br/>
 * <b>修改时间：</b>2015-4-15 上午10:09:34<br/>
 * <b>修改备注：</b><br/>
 * <b>版本信息：</b>v1.0.0<br/>
 */
@Controller
@Scope("prototype")
@RequestMapping("/report")
public class ReportController extends CimsBaseController {
	
	@Autowired
	@Qualifier("com.jy.modules.cims.deal.service.DealService")
	public DealService dealService;


    /**
     *  统计查询每天合作机构的转让债权价值、赎回债权价值、匹配债权价值
     * @Title getDealCreditDetailTotalByDay
     * @Description TODO
     * @param request
     * @param dto
     * @param dataMsg
     * @return 
     * DataMsg 
     * @author lizhiqiang
     * @date 2015-4-15-上午10:33:46
     * @update 
     * @throws
     */
    @RequestMapping(value = "/getDealCreditDetailTotalByDay")
	@ResponseBody
    public DataMsg getDealCreditDetailTotalByDay(HttpServletRequest request, TCMmCooperorgDealDTO dto, @ModelAttribute DataMsg dataMsg){
    	Map<String, Object> searchParams = new HashMap<String, Object>();
		searchParams.put("dto", dto);
		QueryReqBean params = new QueryReqBean();
		params.setSearchParams(searchParams);
		PageParameter pageInfo = PageUtil.toPageParameter(dataMsg);
		params.setPageParameter(pageInfo);
		
    	List<CreditRightTotalDto> list = dealService.getDealCreditDetailTotalByDay(params.getSearchParams());
		dataMsg.setData(list);
		dataMsg.setTotalRows(pageInfo.getTotalCount());
    	return dataMsg;
    }

}